package com.hb.core.oauth2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;

/**
 * @description: 令牌持久化配置
 * @projectName: zhb-frame-build
 * @author: zhouhaizhi
 * @createTime: 2021/8/30 10:38
 * @version:1.0
 */
@Configuration
public class TokenStoreConfig {

    private final JwtAccessTokenConverter jwtAccessTokenConverter;

    @Autowired
    public TokenStoreConfig(JwtAccessTokenConverter jwtAccessTokenConverter) {
        this.jwtAccessTokenConverter = jwtAccessTokenConverter;
    }

    /**
     *@描述 注册一个令牌的持久化实现
     *@创建人 zhouhaizhi
     *@创建时间 2021/8/30 10:46
     *@参数
     *@返回值
     *@修改人和其它信息
     */
    @Bean
    public TokenStore tokenStore(){
        return new JwtTokenStore(jwtAccessTokenConverter);
    }
}
